package zju.lzy.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import zju.lzy.dto.StatDTO;

import java.util.List;

/**
 * @author lzy
 */
@Mapper
public interface StatMapper {

    @Insert("insert into stat values (#{timestamp},#{devNum},#{activeDevNum},#{topicNum},#{activeTopicNum});")
    boolean insertStat(StatDTO stat);


    @Select("select * from stat order by timestamp desc limit #{cnt};")
    List<StatDTO> getRecentStat(@Param("cnt") Integer cnt);

}
